﻿using PlayerRoles;
using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Enums;
using PluginAPI.Events;
using RoleCustom.Main;
using Utils;


namespace RoleCustom.Event
{
    public class SCP0492Event
    {
        [PluginEvent(ServerEventType.PlayerSpawn)]
        public void OnPlayerSpawn(PlayerSpawnEvent ev)
        {
            TimeCoroutine.Delay(0.5f, () =>
            {
                Log.Info($"检查：{ev.Player.Role}");

                if (ev.Player.Role != RoleTypeId.Scp0492) return;

                Log.Info($"DO：{ev.Player.Role}");

                PlayerUtils.SetHP(ev.Player,
                    CodeLoad.Singleton.Config.SCP0492Event.Health,
                    CodeLoad.Singleton.Config.SCP0492Event.Health);

                PlayerUtils.SetAP(ev.Player,
                    CodeLoad.Singleton.Config.SCP0492Event.AHealth,
                    CodeLoad.Singleton.Config.SCP0492Event.AHealth);
            });
        }
    }
}
